<template>
	<view class="" style="background: #FFF;    min-height: 100vh;">
		<view class="mainBox">
			<!-- 列表 -->
			<view class="itemList">
				<view class="itemLable">报名状态</view>
				<view class="itemValue sussess" v-if="status == 2">已报名</view>
				<view class="itemValue error" v-if="status != 2">未报名</view>
			</view>

			<!-- 注意，如果需要兼容微信小程序，最好通过setRules方法设置rules规则 -->
			<u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
				<u-form-item label="姓名" prop="userInfo.realName" disabled borderBottom ref="item1" label-width="100rpx">
					<u--input v-model="model1.userInfo.realName" disabled border="none" placeholder="请输入姓名"></u--input>
				</u-form-item>
				<u-form-item label="手机" prop="userInfo.phone" disabledborderBottom ref="item1" label-width="100rpx">
					<u--input v-model="model1.userInfo.phone" border="none" placeholder="请输入手机号"></u--input>
				</u-form-item>
				<u-form-item label="参赛类型" prop="userInfo.email" disabled borderBottom ref="item1" label-width="120rpx">
					<u--input v-model="model1.userInfo.email" border="none" placeholder="请输入邮箱"></u--input>
				</u-form-item>
				<u-form-item
					label="性别"
					prop="userInfo.sex"
					disabled
					borderBottom
					@click="
						showSex = true;
						hideKeyboard();
					"
					ref="item1"
					label-width="100rpx"
				>
					<u--input v-model="model1.userInfo.sex" disabled disabledColor="#ffffff" placeholder="请选择性别" border="none"></u--input>
				</u-form-item>
				<u-form-item label="学生证号" prop="userInfo.idNumber" disabled borderBottom ref="item1" label-width="150rpx">
					<u--input v-model="model1.userInfo.idNumber" border="none" placeholder="请输入学生证号"></u--input>
				</u-form-item>
				<u-form-item label="身份证号" prop="userInfo.cardNumber" disabled borderBottom ref="item1" label-width="150rpx">
					<u--input v-model="model1.userInfo.cardNumber" border="none" placeholder="请输入身份证号"></u--input>
				</u-form-item>
				<u-form-item
					label="入学时间"
					prop="userInfo.inTime"
					borderBottom
					disabled
					@click="
						showBirthday = true;
						hideKeyboard();
					"
					ref="item1"
					label-width="150rpx"
				>
					<u--input v-model="model1.userInfo.inTime" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input>
				</u-form-item>
			</u--form>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			id: '',
			cardNumber: 'a',
			createTime: '2023-04-14T14:32:50',
			email: 'a',
			id: '1646763420552298497',
			idNumber: 'a',
			inTime: '2013-01-01',
			password: 'Asd0.123',
			phone: 'a',
			realName: 'a',
			sex: '男',
			status: '2', //2报名成功 不是2就是报名失败
			userName: 'aaa',

			model1: {
				userInfo: {
					realName: '',
					phone: '',
					email: '',
					idNumber: '',
					cardNumber: '',
					sex: '',
					inTime: '',
					id: ''
				}
			}
		};
	},

	onLoad(item) {
		console.log(item);
	},
	mounted() {
		const Id = uni.getStorageSync('Id');
		if (Id) {
			this.id = Id;
		}
		this.$http({
			url: `contest/myInformation?id=${this.id}`,
			method: 'POST'
		}).then(res => {
			if (res.code == 200) {
				if (res.data) {
					this.model1.userInfo.cardNumber = res.data.cardNumber;
					this.model1.userInfo.createTime = res.data.createTime;
					this.model1.userInfo.email = res.data.email;
					this.model1.userInfo.idNumber = res.data.idNumber;
					this.model1.userInfo.inTime = res.data.inTime;
					this.model1.userInfo.phone = res.data.phone;
					this.model1.userInfo.realName = res.data.realName;
					this.model1.userInfo.sex = res.data.sex;
					this.model1.userInfo.status = res.data.status;
					this.model1.userInfo.userName = res.data.userName;
				}
				// uni.showToast({
				// 	title: '恭喜您，报名成功',
				// 	icon: 'none',
				// 	duration: 2000
				// })
				// setTimeout(() => {
				// 	uni.switchTab({
				// 		url: '/pages/index/index'
				// 	});
				// }, 2000)
			}
		});
	},
	methods: {}
};
</script>

<style lang="scss" scoped>
.mainBox {
	padding: 26rpx 32rpx;

	.itemList {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 32rpx 0px;
		border-bottom: 1px solid #eeeeee;

		.itemLable {
			font-size: 36rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #27282e;
		}

		.itemValue {
			font-size: 36rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #27282e;
		}

		.sussess {
			color: #00ac49;
		}

		.errof {
			color: #d80000;
		}
	}

	.mainBox {
		padding: 26rpx 32rpx;

		::v-deep .u-form-item__body__left {
			font-size: 36rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #27282e;
			width: 144rpx !important;
		}

		::v-deep .u-form-item__body {
			padding: 20rpx 0rpx !important;
		}

		::v-deep .u-button--info {
			margin-top: 44rpx !important;

			height: 104rpx !important;
			background: #3b72ec;
			border-radius: 4rpx;
			font-size: 32rpx !important;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #ffffff !important;
		}
	}

	/deep/ .u-input__content__field-wrapper__field {
		text-align: right !important;
	}
}
</style>
